<?

$COracle = new oracleDb;
$COracle->init($_SESSION["ORCL"],
               $_SESSION["OPASS"],
               $_SESSION["SID"],
               _NO_COMMENT);

$srcDbCurrency  = "MST_CURRENCY";
$srcDbWarehouse = "MST_WAREHOUSE";

if($COracle->connect()){

  $_SESSION["tmpJid"] = (!empty($_SESSION["tmpJid"]))? $_SESSION["tmpJid"] :
                                                       $GProcessors->getTmpJid();

  $_POST["memoEnt"]   = (!empty($_POST["memoEnt"]))? $_POST["memoEnt"] : "default";

  $lstSuppCst         = $Misc->retArray($_POST["suppCstNameEnt"]);

  $CLFetchers->fetchLstCurrency($COracle,
                                $srcDbCurrency,
                                $lstCurrency);

  $propSuppCst  = $CJs->jsOnFocus("GMisc.setYellow2(this);
                                   Ajax.suppCst(\"suppCstNameEnt\",
                                                \"typeEnt\");").

                  $CJs->jsOnBlur ("Ajax.suppCstCode(\"suppCstCodeEnt\",
                                                    \"suppCstNameEnt\",
                                                    \"typeEnt\");
                                   GMisc.setWhite2(this);");

  $propCurrency = $CJs->jsOnFocus ("GMisc.setYellow2(this);").

                  $CJs->jsOnChange("Ajax.getRate(this.value,
                                                 \"trDateEnt\",
                                                 \"rateEnt\");" ).

                  $CJs->jsOnBlur  ("GMisc.setWhite2(this);");

  $propTaxPctg  = $CJs->jsOnFocus(" GMisc.setYellow2(this);").

                  $CJs->jsOnBlur (" setXPctg(\"amountEnt\",
                                             \"taxPctgEnt\",
                                             \"taxEnt\");
                                    GMisc.setWhite2(this);");

  $propDiscPctg = $CJs->jsOnFocus(" GMisc.setYellow2(this);").

                  $CJs->jsOnBlur (" setXPctg(\"amountEnt\",
                                             \"hdrDiscPctgEnt\",
                                             \"hdrDiscEnt\");
                                    GMisc.setWhite2(this);");

  $propPayable  = $CJs->jsOnFocus(" GMisc.setYellow2(this);
                                    calcPayable(\"amountEnt\",
                                                \"taxEnt\",
                                                \"hdrDiscEnt\",
                                                \"expenseEnt\",
                                                \"prepaidEnt\",
                                                \"payableEnt\");").

                  $CJs->jsOnBlur (" GMisc.setWhite2(this); ");

  $propCrTerm   = $CJs->jsOnFocus("GMisc.setYellow2(this);
                                   Ajax.crTerm(\"crTermEnt\",
                                               \"trDateEnt\",
                                               \"dueDateEnt\");").

                  $CJs->jsOnBlur ("GMisc.setWhite2(this);");

  echo 	$CJs->includeThis(_TYPE_CSS,"/ecs/myMenu.css").
        $CJs->includeThis(_TYPE_JS ,"/ecs/javascript/GMisc.js").
        $CJs->includeThis(_TYPE_JS ,"/ecs/javascript/GAjax.js").
        $CJs->includeThis(_TYPE_JS ,"javascript/misc.js").
        $CJs->includeThis(_TYPE_JS ,"javascript/ajax.js").
        $CJs->stopRKey().

        "<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"/ecs/javascript/CalendarPopup.js\"></SCRIPT> \n".
  			"<SCRIPT LANGUAGE=\"JavaScript\">\n".
  			"var cal      = new CalendarPopup();\n".
  			"var gStatus    = Array();\n".
  			"    gStatus[0] = false;\n".

  			"</SCRIPT> \n".

   			"<form  name='initMe' action=entry.php method=post>\n".

   			/**
   			* Global header
   			*
   			*/
  			"<table border='1' class='dedeq' >\n".
  			"<tr>\n".

  			  "<td class='solid'><b>DATE <b>
  			    <input type='submit'
  			           onClick=\"cal.select(document.forms['initMe'].trDateEnt,
  			                                'anchor1',
  			                                'dd-MM-yyyy');
  			                     return false;\"
                             NAME=\"anchor1\"
                             ID=\"anchor1\"
                             value='Select'></b></td>
  			  <td >	".$CHtml->formInput("trDateEnt",
                                    $_POST["trDateEnt"],
                                    $stdStyle .
                                    $stdProperties)." </td> \n".

  		    "</tr>\n".
  		    "<tr>\n".

  			  "<td class='solid'><b>DUE  <b>
  			    <input type='submit'
  			           onClick=\"cal.select(document.forms['initMe'].dueDateEnt,
  			                                'anchor1',
  			                                'dd-MM-yyyy');
  			                     return false;\"
  			           NAME=\"anchor1\"
  			           ID=\"anchor1\"
  			           value='Select'></b></td>
  			   <td >".$CHtml->formInput("dueDateEnt",
                                    $_POST["dueDateEnt"],
  			                            $stdStyle .
                                    $stdProperties)." </td> \n".
  			"</tr>\n".
  			"<tr>\n".

          "<td class='solid'><b> CUSTOMER </b></td>

           <td>  <table border='1' class='dedeq'>
                 <tr>

                 <td> ".$CHtml->formDropDown("suppCstNameEnt",
                                             $_POST["suppCstNameEnt"],
                                             $lstSuppCst,
                                             $propSuppCst)." </td>

                 <td> ".$CHtml->formInput("suppCstCodeEnt",
                                          $_POST["suppCstCodeEnt"],
                                          $Misc->stdProperties())." </td>
                 </tr>
                 </table> </td>\n".

        "</tr>\n".
        "<tr>\n".

  			  "<td class='solid'><b>CURRENCY </b></td>

  			  <td> ".$CHtml->formDropDown("currencyEnt",
                                      $_POST["currencyEnt"],
                                      $lstCurrency,
                                      $propCurrency )." </td>\n".

        "</tr>\n".
        "<tr>\n".

  			  "<td class='solid'><b>RATE     </b></td>

  			  <td> ".$CHtml->formInput("rateEnt",
                                   $_POST["rateEnt"],
                                   $Misc->stdNumStyle(5).
                                   $Misc->stdProperties())."</td>\n".

  			"</tr>\n".
  			"<tr>\n".

  			  "<td class='solid'><b>CR-TERM  </b></td>

  			  <td> ".$CHtml->formInput("crTermEnt",
                                   $_POST["crTermEnt"],
                                   $Misc->stdNumStyle(5).
                                   $propCrTerm)." </td>\n".

        "</tr>\n".
  			"<tr>\n".

  		    "<td class='solid'><b>NOTA SOURCE</b></td>

  		    <td> ".$CHtml->formInput("notaSrcEnt",
                                   $_POST["notaSrcEnt"],
                                   $Misc->stdProperties())." </td>\n".

  		  "</tr>\n".
        "<tr>\n".

  			  "<td class='solid'><b>MEMO     </b></td>

  			  <td> ".$CHtml->formTextArea("memoEnt",
                                      $_POST["memoEnt"],
                                      $Misc->stdStyle100().
                                      $Misc->stdProperties())."   </td>\n".

  			"</tr>\n".

        $CHtml->formHidden("typeEnt",
                           _CASH_BANK_IN).

        $CHtml->formHidden("txEnt",
                           _CASH_BANK_DP_NAME ).

  			"</table><br/>\n";
}
?>
